package com.x.Part6_thisDemo;

/**
 * ClassName: Bank
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2023/10/13 2:26
 */
public class Bank {
    private Customer[] customers;
    private  int numOfCustomer;

    public Bank(){
        customers = new Customer[15];
    }

    //将指定姓名的客户放入客户列表中
    public void addCustomer(String f, String l){
        Customer cust = new Customer(f, l);

        //将对象放入数组
        customers[numOfCustomer++] = cust;
        //numOfCustomer ++;
    }

    public int getNumOfCustomer(){
        return numOfCustomer;
    }

    //获取具体客户
    public Customer getCustomer(int index){
        if(0<=index && index <= numOfCustomer-1)
            return customers[index];
        else {
            System.out.println("客户范围越界");
            return null;
        }
    }

}
